<template>
  <div class="container">

    <IForm :formFrame="frame" class="form-container" :formData.sync="form"></IForm>
    <div slot="action">
      <a-button class="btn" type="primary" @click="submit">保存</a-button>
    </div>
  </div>
</template>

<script>
  import IForm from "@/components/IForm"

  const resourceType = 'pay_switch'

  export default {
    components: {
      IForm
    },
    data() {
      return {
        uuid: '',
        form: {
        }
      }
    },
    computed: {
      categoryOptions() {
        return this.categoryList.map(item => {
          return {
            title: item.title,
            value: item.id
          }
        })
      },
      frame() {
        return [
          {
            title: 'app支付方式配置',
            key: 'app_pay_switch',
            type: 'pay_type_input',
            tips: '',
            newline: true,
            required: true,
          }
        ]
      }
    },
    created() {
      this.$http.get(`/setting/sys/${resourceType}`).then(res => {
        this.form.app_pay_switch = res.data.setting || []
        this.$set(this.form)
      })
    },
    mounted() {},
    watch: {},
    methods: {
      cancel() {
        this.$router.back(-1)
      },
      submit() {
        this.$http.post(`/setting/sys/${resourceType}`, {
          setting: this.form.app_pay_switch
        }).then(res => {
          this.$message.success('保存成功')
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .form-container {
    padding-bottom: 120px;
  }

  .container {
    .btn {
      margin-right: 30px;
    }
  }
</style>
